package com.woniuxy.main.dynamic_lzq.service.impl;

import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniuxy.main.dynamic_lzq.mapper.CoachMapper_Lzq;
import com.woniuxy.main.dynamic_lzq.mapper.UserMapper_Lzq;
import com.woniuxy.main.dynamic_lzq.pojo.Coach;
import com.woniuxy.main.dynamic_lzq.pojo.User;
import com.woniuxy.main.dynamic_lzq.service.UserService_Lzq;

import lombok.Data;



@Data
@Service
@Transactional
public class UserServiceImpl_Lzq implements UserService_Lzq{
	@Autowired
	private UserMapper_Lzq userMapper;
	
	private CoachMapper_Lzq coachMapper;
	
		
	@Override
	public List<User> allUser() {// TODO Auto-generated method stub
		
		return userMapper.allUser();
	}



	@Override
	public void addUser(User user) {
		
	}



	@Override
	public User findUserByName(String uname) {
		return userMapper.findUserByName(uname);
	}



	@Override
	public List<User> listCoaches() {
		
		return userMapper.listCoaches();
	}



	@Override
	public User findUserByUid(int user_id) {
		return userMapper.findUserByUid(user_id);
	}



	@Override
	public List<User> findUsersByCoaches(List<Coach> coaches) {
		List<User> users = new ArrayList<User>();
		for(int i=0;i<coaches.size();i++){
			Coach coach = coaches.get(i);
			User user = userMapper.findUserByUid(coach.getUser_id());
			users.add(user);
		}
		return users;
	}



	@Override
	public List<User> listVenues() {
		
		return userMapper.listVenues();
	}



	@Override
	public List<User> listStudents() {
		
		return userMapper.listStudents();
	}



	
	
	
	
	

	
	
	

}
